import { BasicColumn, FormSchema } from '/@/components/Table';
import { defaultRule } from '@/utils/common/validator';
import {
  userOrderNumFormItem,
  userRemarkFormItem,
  userStatusFormItem,
  userStatusFormItemSelect,
} from '@/settings/ShareFormItem';
import { userRemarksColumn, userStatusColumn } from '@/settings/ShareTableColumns';

export const useGradeCategoryUpdateSchemaForm = (): FormSchema[] => {
  return [
    {
      field: 'name',
      label: '名称',
      component: 'Input',
      rules: defaultRule(),
    },
    userOrderNumFormItem({ colProps: { span: 12 } }),
    userStatusFormItem(),
    userRemarkFormItem(),
    { field: 'id', label: '类别ID', component: 'Input', show: false },
  ];
};

export const useGradeCategoryListColumns = (): BasicColumn[] => {
  return [
    // { title: 'ID', dataIndex: 'id' },
    { title: '名称', dataIndex: 'name' },
    { title: '排序值', dataIndex: 'orderNum' },
    userStatusColumn(),
    userRemarksColumn(),
  ];
};

export const useGradeCategoryListSearchForm = (): FormSchema[] => {
  return [
    { field: 'name', label: '名称', component: 'Input' },
    { field: 'remarks', label: '备注', component: 'Input' },
    userStatusFormItemSelect(),
  ];
};
